from flask import current_app
from itsdangerous import TimedJSONWebSignatureSerializer as Serializer


def get_token():
    # 生成token
    s = Serializer(current_app.config['SECRET_KEY'], expires_in=2 * 24 * 3600)  # expiration是过期时间
    token = s.dumps({'id': 'login'}).decode('ascii')
    return token
